package com.nbsaas.boot.pms.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "工时记录", model = "工时记录")
@Entity
@Table(name = "bs_pms_time_entry")
@Comment("工时记录表")
public class TimeEntry extends AbstractEntity {

    @Comment("项目ID")
    @FormField(title = "项目", sortNum = "1", grid = true, type = InputType.select)
    private Long projectId;

    @Comment("任务ID")
    @FormField(title = "任务", sortNum = "2", grid = true, type = InputType.select)
    private Long taskId;

    @Comment("用户ID")
    @FormField(title = "用户", sortNum = "3", grid = true, type = InputType.select)
    private Long userId;

    @Comment("工作日期")
    @FormField(title = "工作日期", sortNum = "4", type = InputType.date, grid = true)
    private Date workDate;

    @Comment("开始时间")
    @FormField(title = "开始时间", sortNum = "5", type = InputType.date, grid = true)
    private Date startTime;

    @Comment("结束时间")
    @FormField(title = "结束时间", sortNum = "6", type = InputType.date, grid = true)
    private Date endTime;

    @Comment("工作时长(小时)")
    @FormField(title = "工作时长(小时)", sortNum = "7", grid = true, type = InputType.el_input_number, sort = true)
    private BigDecimal hours;

    @Comment("工作描述")
    @FormField(title = "工作描述", sortNum = "8", type = InputType.textarea, col = 23)
    @Column(columnDefinition = "TEXT")
    private String description;

    @Comment("工作类型")
    @FormField(title = "工作类型", sortNum = "9", grid = true, type = InputType.select)
    @Column(length = 20)
    private String workType; // DEVELOPMENT-开发, TESTING-测试, DESIGN-设计, DOCUMENTATION-文档, MEETING-会议, OTHER-其他

    @Comment("是否计费")
    @FormField(title = "是否计费", sortNum = "10", grid = true, type = InputType.select)
    private Boolean billable;

    @Comment("小时费率")
    @FormField(title = "小时费率", sortNum = "11", grid = true, type = InputType.el_input_number, sort = true)
    @Column(precision = 10, scale = 2)
    private BigDecimal hourlyRate;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "12", type = InputType.textarea, col = 23)
    @Column(columnDefinition = "TEXT")
    private String remarks;
} 